// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-nocheck
import { ipcRenderer, contextBridge, webFrame, IpcRendererEvent, webUtils } from 'electron';

contextBridge.exposeInMainWorld('api', {
    isDev: process.env.NODE_ENV === 'development',
    platform: process.platform,
    close: () => ipcRenderer.send('window-close'),
    requestClose: {
        on: (cb) => ipcRenderer.on('request-window-close', cb),
        removeListener: (cb) => ipcRenderer.removeListener('request-window-close', cb),
      },
});

type AnyObj = Record<string, never>;

declare global {
    interface Window {
        api: {
            platform: string;
            isDev: boolean;
            minimize: () => void;
            toggleMaximizeMode: () => void;
            close: () => void;
        };
    }
}
